//右滑关闭
// mui.init({
// 	swipeBack: true, //启用右滑关闭
// })
var TypeID;
var data = GetRequest();
var UserName = localStorage.getItem("UserName");
var UserNO = localStorage.getItem("UserNO");
mui.plusReady(function() {
	xccpostAsync("api/PDA/GetPDAMenu", {
		UserNO: UserNO
	}, function(data) {
		if (data.Code == 200) {
			for (var i = 0; i < data.Items.length; i++) {

				if (data.Items[i].Menus.length > 0) {
					$(".mui-content").append(
						`<div class="module-title">${data.Items[i].ModuleName}</div>`);
					// 按id从小到大排序
					data.Items[i].Menus.sort((a, b) => a.MenuNO - b.MenuNO);
					$(".mui-content").append(`
						<div id="${i}" class="grid-container">
						</div>`)
					for (var j = 0; j < data.Items[i].Menus.length; j++) {
						$(`#${i}`).append(`
				               <div class="grid-item" onclick="MfgWorkOrderInfo('${data.Items[i].Menus[j].MenuUrl}')">
				               	<span class="iconfont ${data.Items[i].Menus[j].IconName}"></span>
				               	<div class="item-title">${data.Items[i].Menus[j].MenuName}</div>
				               </div>
		                	`)
					}
				}

			}
		} else {
			mui.toast(data.Message, {
				duration: '1000',
				type: 'div'
			});
		}
		plus.nativeUI.closeWaiting();
	}, function(error) {
		console.log("没有数据....");

		plus.nativeUI.closeWaiting();
	});
	plus.nativeUI.closeWaiting();
	//显示当前页面
	//mui.currentWebview.show();
});


// 0 贴片上料  1 QC检验  2  物料接料  3  一键下料
function MfgWorkOrderInfo(url) {
	localStorage.setItem("UserName", UserName);
	mui.openWindow({
		url: url,
		action: UserName
	})
}